/**
 * 
 *	利得金融
 * Copyright (c) 2013-2015 LeadBank,Inc.All Rights Reserved.
 */
package com.leadbank.springboot.example.util.context;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

/**
 * 
 * @author daniel
 * @version $Id: SpringContextHolder.java, v 0.1 2015-7-27 下午7:04:23 daniel Exp $
 */
public class SpringContextHolder implements ApplicationContextAware {
    private static ApplicationContext applicationContext;
    /** 
     * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
     */
    @Override
    public void setApplicationContext(ApplicationContext arg0) throws BeansException {
        applicationContext = arg0;
    }
    
    public static Object getBean(String beanId)
    {
      return applicationContext.getBean(beanId);
    }
    
    public static ApplicationContext getApplicationContext()
    {
      return applicationContext;
    }

}
